import request from '@/utils/request'
import { tokensToFunction } from 'path-to-regexp'
import { getToken } from '@/utils/auth'

export function login(data) {
  return request({
    
    // url: '/login',
    url:"user/login",
    method: 'post',
    data
  })
}

export function register(data){
   return request({
     url:"user/register",
     method:'post',
     data
   })

}

export function resetPassword(data){
  return request({
    url:"user/update_password",
    method:'post',
    headers:{
      Authorization:getToken()
    },
    data
  })


}


export function getInfo(token) {
  return request({
  
    url: '/user/info',
    method: 'post',
    
    headers:{
      Authorization:token
    },
    // params: { token }
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}
